package cn.iocoder.an.module.business.dal.mysql.codelist;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.business.dal.dataobject.codelist.CodeListDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.business.controller.admin.codelist.vo.*;

/**
 * 编码信息 Mapper
 *
 * @author zzy
 */
@Mapper
public interface CodeListMapper extends BaseMapperX<CodeListDO> {

    default PageResult<CodeListDO> selectPage(CodeListPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CodeListDO>()
                .likeIfPresent(CodeListDO::getCode, reqVO.getCode())
                .likeIfPresent(CodeListDO::getPartNumber, reqVO.getPartNumber())
                .eqIfPresent(CodeListDO::getFactoryInfo, reqVO.getFactoryInfo())
                .betweenIfPresent(CodeListDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CodeListDO::getUpdateTime));
    }

}